package com.yl.rabbitmq.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * @author yangl
 * 此类为连接工厂创建信道的工具类
 */
public class RabbitMQUtil {
    public static Channel getChannel() throws Exception{
        //创建链接工厂
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("10.73.185.123");
        factory.setUsername("admin");
        factory.setPassword("123456");
        //创建一个信道链接
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        return channel;
    }
}
